//
//  UIButton+Tools.m
//  BiaoPny
//
//  Created by QF_iOS on 2017/5/15.
//  Copyright © 2017年 BiaoPu. All rights reserved.
//

#import "UIButton+Tools.h"

@implementation UIButton (Tools)
/** 创建button */
+ (UIButton *)createBtnFrame:(CGRect)frame title:(NSString *)title titleColor:(UIColor*)tittleColor titleFont:(UIFont *)font bgColor:(UIColor *)bgColor radius:(CGFloat)radius inSuperView:(UIView *)superView
{
    UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
    btn.frame = frame;
    btn.backgroundColor = bgColor;
    [btn setTitle:title forState:UIControlStateNormal];
    [btn setTitleColor:tittleColor forState:UIControlStateNormal];
    btn.titleLabel.font = font;
    if (radius > 0) {
        btn.layer.cornerRadius  = radius;
        btn.layer.masksToBounds = YES;
    }
    [superView addSubview:btn];
    return btn;
}

+ (UIButton *)createBtnFrame:(CGRect)frame imageName:(NSString *)imageName radius:(CGFloat)radius inSuperView:(UIView *)superView
{
    UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
    btn.frame = frame;
    [btn setImage:[UIImage imageNamed:imageName] forState:UIControlStateNormal];
    //设置圆角
    if (radius > 0) {
        btn.layer.cornerRadius  = radius;
        btn.layer.masksToBounds = YES;
    }
    [superView addSubview:btn];
    return btn;
    
}


@end
